# This Python file uses the following encoding: utf-8
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from form import *
import os



def cur_file_dir():
# 获取脚本路径
     path = sys.path[0]

# 判断为脚本文件还是py2exe编译后的文件，如果是脚本文件，则返回的是脚本的目录，如果是py2exe编译后的文件，则返回的是编译后的文件路径
     if os.path.isdir(path):
         return path
     elif os.path.isfile(path):
         return os.path.dirname(path)

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    m = Ui_Form()
    m.setWindowIcon(QIcon(cur_file_dir()+'\\ico.png'))
    m.show()
    # ...
    sys.exit(app.exec_())
